<?php
	include './init.php';
	$model=new Model('category');
	$goods_model=new Model('goods');
	$sql="select `name`,`id` from `category` where status=1 and pid=0 limit 0,5";
	$list=$model->find($sql);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="<?php echo URL;?>/public/css/index.css">
	<link rel="stylesheet" type="text/css" href="<?php echo URL;?>/public/css/reg.css">
	<link rel="stylesheet" type="text/css" href="<?php echo URL;?>/public/css/login.css">
</head>
<body>
	<!--导航-->
	<div id="header">
		<div class="top">
			<ul>
				<?php if (empty($_SESSION['user'])) :?>
					<a href="<?php echo URL?>/reg.php"><li>注册</li></a>
					<a href="<?php echo URL;?>/login.php"><li>请登录</li></a>
				<?php else:?>
					<a href="<?php echo URL;?>/action.php?a=loginout"><li>退出</li>
					<a href="<?php echo URL;?>/personal.php"><li><?php echo $_SESSION['user']['username'];?></li></a>
				<?php endif;?>
				<a href=""><li><?php echo date('m月d日',time());?></li></a>
			</ul>
		</div>
		<div class="main">
			<ul>
				<li class="img"></li>
				<a href="<?php echo URL?>/index.php"><li class="index">首页</li></a>
				<?php foreach ($list as $key => $value) :?>
					<a href="<?php echo URL;?>/list.php?cate_id=<?php echo $value['id'];?>"><li><?php echo $value['name'];?></li></a>
				<?php endforeach;?>
			</ul>
		</div>
	</div>
